﻿using System;
using System.Collections.Generic;
using System.Linq;
using SD.LLBLGen.Pro.ORMSupportClasses;
using SD.LLBLGen.Pro.LinqSupportClasses;
using Northwinddemo.BusinessLayer.Repository.Abstract;
using Northwinddemo.DAL.EntityClasses;
using Northwinddemo.DAL.DatabaseSpecific;
using Northwinddemo.DAL.Linq;
using MvcContrib.Pagination;
using System.Collections.Specialized;
using BaseBL;
using xVal.ServerSide;

namespace Northwinddemo.BusinessLayer.Repository.Concrete
{
    public class CategoriesRepository : NortwindRepository<CategoriesEntity>, ICategoriesRepository
    {

        public override CategoriesEntity GetById(int categoryId, IDataAccessAdapter adapter)
        {
            return (from c in new LinqMetaData(adapter).Categories
                    where c.CategoryId == categoryId
                    select c).Single();
        }

        public override IList<CategoriesEntity> GetAll(IDataAccessAdapter adapter)
        {
            return (from c in new LinqMetaData(adapter).Categories
                    orderby c.CategoryName
                    select c).ToList();
        }

    }
}
